#!/bin/sh

start()
{
	echo "start inotify process ......"
	LOGFILE="/root/pcode/h_inotify/inotify-tools-3.14/src/even_w.txt"
	if [ $1 = "wait" ] ; then
		echo ".......inotifywait ......"
		touch $LOGFILE
	#./inotifywait -rmq -e modify -e moved_from -e moved_to -e move -e create -e delete test  -o $LOGFILE  &
	./inotifywait -rmq --format '%w|%e|%f' -e modify -e moved_from -e moved_to -e move -e create -e delete test  -o $LOGFILE  &
	fi

	if [ $1 = "watch" ] ; then
		echo ".......inotifywatch ......"
		./inotifywatch -rv test &
	fi
}

stop()
{
	echo "stop inotifywait process ......"
	killall lt-inotifywait
	killall lt-inotifywatch
}

case $1 in
	start)
		start $2
		;;
	stop)
		stop
		;;
esac
